package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Attendance;
import cn.wolfcode.crm.domain.Employee;
import cn.wolfcode.crm.domain.Task;
import cn.wolfcode.crm.mapper.AttendanceMapper;
import cn.wolfcode.crm.mapper.TaskMapper;
import cn.wolfcode.crm.query.AttendanceQueryObject;
import cn.wolfcode.crm.query.TaskQueryObject;
import cn.wolfcode.crm.service.IAttendanceService;
import cn.wolfcode.crm.service.ITaskService;
import cn.wolfcode.crm.util.PageResult;
import cn.wolfcode.crm.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2018/6/12.
 */

@Service
public class TaskServiceImpl implements ITaskService {

    @Autowired
    TaskMapper taskMapper;


    @Override
    public PageResult query(TaskQueryObject qo) {
        int count = taskMapper.query4Count(qo);
        if (count > 0) {
            return new PageResult(count, taskMapper.query4List(qo));
        }
        return new PageResult(count, Collections.EMPTY_LIST);
    }

    @Override
    public void updateByPrimaryKey(Task task) {
        taskMapper.updateByPrimaryKey(task);
    }

    @Override
    public void insert(Task task) {
        taskMapper.insert(task);
    }

    @Override
    public void changeState(Task task) {
        taskMapper.changeState(task);
    }

    @Override
    public List<Task> selectAll() {
        return taskMapper.selectAll();
    }
}
